<?php
use common\Yii01;
use yii\widgets\LinkPager;
use yii\bootstrap\Alert;

/**
 * @var $model
 * @var $keywords
 * @var $type
 * @var $pages
 * @var $description
 */
?>
<?php
$this->title = "发现";
$this->registerMetaTag(["name" => "keywords", "content" => "{$keywords}"]);
$this->registerMetaTag(["name" => "description", "content" => "{$description}"]);
?>


<?php if(!$model):?>
    <div class="main pd20">
        <?php
        Alert::begin([
            'options' => [
                'class' => 'alert-warning',
            ],
        ]);
        ?>
        您还没有订阅过的板块,点击<a href="<?=Yii::$app->urlManager->createUrl(['list/index'])?>">这里</a>开始订阅
        <?php  Alert::end(); ?>
    </div>
<?php else : ?>


    <div class="main">

        <!-- Nav tabs -->
        <div role="tabpanel" style="position:relative;">

            <div class="panel">
                <div class="row">
                     <div class="col-xs-3">
                        <a href="<?=Yii::$app->homeUrl?>">
                            <img class="site-logo" src="<?=Yii::$app->urlManager->baseUrl.'/img/logo.png'?>"/>
                        </a>
                    </div>
                    <div class="col-xs-9">
                         <div class="site-info">

                        </div>
                        <ul class="nav nav-tabs" role="tablist" style="margin-left: 20px;">
                            <li role="presentation"<?php if($type ==null) echo 'class="active"'; ?>><a href="<?=Yii::$app->urlManager->createUrl(['focus/index'])?>">热门</a></li>
                            <li role="presentation"<?php if($type =='new') echo 'class="active"'; ?>><a href="<?=Yii::$app->urlManager->createUrl(['focus/index','type'=>'new'])?>">最&nbsp;新</a></li>
                            <li role="presentation"<?php if($type =='zy') echo 'class="active"'; ?>><a href="<?=Yii::$app->urlManager->createUrl(['focus/index','type'=>'zy'])?>">具有争议的</a></li>
                            <li role="presentation"><a href="#">|</a></li>
                            <li role="presentation"<?php if($type =='url') echo 'class="active"'; ?>><a href="<?=Yii::$app->urlManager->createUrl(['focus/index','type'=>'url'])?>">链&nbsp;接</a></li>
                            <li role="presentation"<?php if($type =='pic') echo 'class="active"'; ?>><a href="<?=Yii::$app->urlManager->createUrl(['focus/index','type'=>'pic'])?>">图&nbsp;片</a></li>
                            <li role="presentation"<?php if($type =='article') echo 'class="active"'; ?>><a href="<?=Yii::$app->urlManager->createUrl(['focus/index','type'=>'article'])?>" >帖&nbsp;子</a></li>
                        </ul>
                    </div>
                </div>

            </div>

            <!-- Tab panes -->
            <div class="tab-content pd20">
                <div role="tabpanel" class="tab-pane active" id="one">
                    <?php foreach($model as $v) :?>
                        <div class="row gbook_box">

                            <!-- 点赞双箭头 -->
                            <div class="col-xs-1">
                                <div class="midcol unvoted" style="text-align: center">
                                    <a href="javascript:;" class="<?php if(Yii01::postZC(Yii::$app->request->getUserIP(),$v['id'],0)):?>active<?php endif;?> zan"><b class="glyphicon glyphicon-chevron-up "></b><br/><span class="num"><?=$v['zan']?></span> <i style="display: none"><?=$v['id']?></i></a>
                                    <a href="javascript:;" class="<?php if(Yii01::postZC(Yii::$app->request->getUserIP(),$v['id'],1)):?>active<?php endif;?> cai"><span class="num"><?=$v['cai']?></span><br/> <b class="glyphicon glyphicon-chevron-down"></b><i style="display: none"><?=$v['id']?></i></a>
                                </div>
                            </div>
                            <!-- 点赞双箭头 -->
                            <div class="col-xs-11 fx_left1">


                                <div class="media">
                                    <?php if(Yii01::getThumb($v['thumb'],$v['url'],$v['content'])):?>
                                        <div class="media-left dialog">
                                            <span id="hide-title" style="display: none;"><?= $v['title']?></span>
                                            <span id="hide-comment" style="display: none;" data-num="<?=Yii01::getComments($v['id'])?>"><?=Yii::$app->urlManager->createUrl(['post/view','id'=>$v['id']])?></span>
                                            <?php if ($v['type'] == 1): ?>
                                                <span id="hide-url" style="display: none;"><?=Yii::$app->urlManager->createAbsoluteUrl(['post/dialog','id'=>$v['id']])?></span>
                                            <?php elseif($v['type'] == 2): ?>
                                                <span id="hide-url" style="display: none;">http://www.wmorz.com/<?=$v['thumb']?></span>
                                            <?php elseif($v['type'] == 3):?>
                                                <span id="hide-url" style="display: none;"><?= $v['url']?></span>
                                            <?php endif; ?>
                                            <?php if($v['type'] != 3):?>
                                                <?php if(strstr(Yii01::getThumb($v['thumb'],$v['url'],$v['content']),"http")):?>
                                                    <img class="media-object" src="<?=Yii01::getThumb($v['thumb'],$v['url'],$v['content'])?>" width="100px" height="90px" alt=" <?= $v['title']?>">
                                                <?php else:?>
                                                    <img class="media-object" src="http://www.wmorz.com/timthumb.php?src=<?=Yii01::getThumb($v['thumb'],$v['url'],$v['content'])?>&h=90&w=100&zc=1" width="100px" height="90px" alt=" <?= $v['title']?>">
                                                <?php endif;?>

                                            <?php endif;?>
                                        </div>
                                    <?php endif;?>
                                    <div class="media-body">
                                        <h4>
                                            <a class="<?php if($v['status'] != 1){echo "zhiding";}?>" href="<?=Yii::$app->urlManager->createUrl(['post/view','id'=>$v['id']])?>" class="" title="<?= $v['title']?>">
                                                <?= $v['title']?>
                                            </a>
                                            <?php if($v['type'] == 3):?>
                                                <span style="color: #666;font-size: 13px"><?=Yii01::getUrl($v['url'])?></span>
                                            <?php endif;?>
                                        </h4>
                                        <div class="gbook_list">
                                            <?php if ($v['type'] == 1): ?>
                                                <span class="type">帖子由</span>
                                            <?php elseif($v['type'] == 2): ?>
                                                <span class="type">图片由</span>
                                            <?php elseif($v['type'] == 3):?>
                                                <span class="type">链接由</span>
                                            <?php endif;?>
                                            <a class="replyuserhead"  data-toggle="popover" data-trigger="focus" data-html="true" data-content='<img src="<?=Yii::$app->urlManager->baseUrl.'/'.$v['img']?>" width="100" height="100">'><img src="<?=Yii::$app->urlManager->baseUrl.'/'.$v['img']?>" width="20" height="20"> </a>
                                            <a href="javascript:;" target="_blank" title=" <?= $v['nickname']?>" class="nickname"> <?= $v['nickname']?></a> <span class="type"><?=Yii01::diffTime($v['create_at'])?>前</span>发布在
                                            <a href="<?=Yii::$app->urlManager->createUrl(['post/index','cid'=>$v['cate']['id']])?>"><?= $v['cate']['name']?></a>
                                        </div>
                                        <p class="text-content dialog">
                                            <span id="hide-title" style="display: none;"><?= $v['title']?></span>
                                            <span id="hide-comment" style="display: none;" data-num="<?=Yii01::getComments($v['id'])?>"><?=Yii::$app->urlManager->createUrl(['post/view','id'=>$v['id']])?></span>
                                            <?php if ($v['type'] == 1): ?>
                                                <span id="hide-url" style="display: none;"><?=Yii::$app->urlManager->createAbsoluteUrl(['post/dialog','id'=>$v['id']])?></span>
                                            <?php elseif($v['type'] == 2): ?>
                                                <span id="hide-url" style="display: none;"><?= "http:/www.wmorz.com/".$v['thumb']?></span>
                                            <?php elseif($v['type'] == 3):?>
                                                <span id="hide-url" style="display: none;"><?= $v['url']?></span>
                                            <?php endif;?>
                                            <?=Yii01::cutStr($v['content'],80)?>
                                        </p>
                                        <div class="small text-left">
                                            <a href="<?=Yii::$app->urlManager->createUrl(['post/view','id'=>$v['id']])?>#comment"><span class="glyphicon glyphicon-comment"></span> <?=Yii01::getComments($v['id'])?>次讨论</a>
                                            <?php if ($v['type'] == 1): ?>
                                                <a target="_blank" href="<?=Yii::$app->urlManager->createUrl(['post/view','id'=>$v['id']])?>"><span class="glyphicon glyphicon-share-alt"></span>新窗口</a>
                                            <?php elseif($v['type'] == 2): ?>
                                                <a target="_blank" href="<?= $v['thumb']?>"><span class="glyphicon glyphicon-share-alt"></span>新窗口</a>
                                            <?php elseif($v['type'] == 3):?>
                                                <a target="_blank" href="<?= $v['url']?>"><span class="glyphicon glyphicon-share-alt"></span>新窗口</a>
                                            <?php endif;?>
                                            <a href="javascript:;" class="collect"><span class="glyphicon glyphicon-heart-empty"></span><em>收藏</em> <i style="display:none"><?=$v['id']?></i></a>
                                            <a href="javascript:;" class="report" style="padding-left: 5px;"><span class="glyphicon glyphicon-trash report"></span> 举报<i style="display:none"><?=$v['id']?></i></a>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>

                    <?php endforeach;?>

                    <!-- 分页 -->
                    <?=LinkPager::widget([
                        'pagination' => $pages,
                    ]);?>
                    <!-- 分页 -->

                </div>

            </div>
        </div>
        <!-- Nav tabs -->
    </div>
<?php endif?>